<?php
session_start();

# auslesen, k fuer klick
$_SESSION['kname'] = isset($_SESSION['kname']) ? $_SESSION['kname'] : '0';
$_SESSION['kvorname'] = isset($_SESSION['kvorname']) ? $_SESSION['kvorname'] : '0';

if (isset($_GET['sstat']))
{
	echo "Vorname: ".$_SESSION['kvorname'];
	echo "Name: ".$_SESSION['kname'];
	echo "<br />\n<a href='{$_SERVER['PHP_SELF']}'>neu</a>";
}
else # immer formular
{
	?>
	<form action="<?php echo $_SERVER['PHP_SELF']?>" method="get">
		Vorname: <input type="text" name="ivorname" />
		Name: <input type="text" name="iname" />
		<input type="submit" name="svorname" value="vorname" />
		<input type="submit" name="sname" value="name" />
		<input type="submit" name="sstat" value="stat" />												
	</form>
	<?php 
	if (isset($_GET['sname']))
	{
		echo "{$_GET['ivorname']} {$_GET['iname']}";
		$_SESSION['kname']++;
	}
	if (isset($_GET['svorname']))
	{
		echo $_GET['ivorname'];
		$_SESSION['kvorname']++;
	}
}
?>
